<template>
  <RHDialog :RHDialog="dialog" :ref="ref">
    <index :RHDetails="details" />
  </RHDialog>
</template>

<script>
import RHDialog from "@/common/dialog/index.vue";
import index from "./index.vue";
import _ from "lodash";
export default {
  name: "dialog_details",
  components: {
    RHDialog,
    index
  },
  props: {
    RHDetailsDialog: {}
  },
  data() {
    return {
      dialog: {
        title: "详情"
      },
      details: {},
      ref: "r_h_details_dialog"
    };
  },
  methods: {
    /**
     * 初始化数据
     */
    initializeDialog() {
      this.dialog = _.defaultsDeep(this.RHDetailsDialog.dialog, this.dialog);
      this.ref =
        "r_h_details_dialog" +
        this.$util.getDataTime(new Date(), "YYYYMMDDHHmmss");
      this.details = _.defaultsDeep(this.RHDetailsDialog.details, this.details);
      this.$forceUpdate();
    },
    closeShow() {
      this.$refs[this.ref].closeShow();
    }
  },
  mounted() {
    this.initializeDialog();
  },
  watch: {
    RHDetailsDialog: {
      handler(newV, oldV) {
        this.RHDetailsDialog = newV;
        this.initializeDialog();
      },
      deep: true
    }
  }
};
</script>

<style scoped></style>
